package com.ethan.minimalist.ui.mine.withdraw

import android.app.Activity
import android.content.Intent
import com.cxz.kotlin.baselibs.base.BaseActivity
import com.cxz.kotlin.baselibs.ext.setSingleClickListener
import com.cxz.kotlin.baselibs.ext.showToast
import com.ethan.minimalist.R
import com.ethan.minimalist.bean.UserBean
import com.ethan.minimalist.constant.Constant
import com.google.gson.Gson
import com.gyf.immersionbar.ImmersionBar
import com.tencent.mmkv.MMKV
import kotlinx.android.synthetic.main.activity_wallet_sec_step.*

/**
 * @ClassName:      WithdrawFirstStepActivity
 * @Description:
 * @Author:         ethanWu
 * @CreateDate:     2020/3/19 9:55
 */
open class WalletSecStepActivity : BaseActivity() {

    private var mUser: UserBean? = null

    override fun attachLayoutRes(): Int {
        return R.layout.activity_wallet_sec_step
    }

    override fun initView() {
        ImmersionBar.with(this@WalletSecStepActivity)
            .statusBarView(top_view)
            .statusBarDarkFont(true, 0.2f)
            .init()
    }

    override fun initData() {
        super.initData()
        mUser =
            Gson().fromJson(MMKV.defaultMMKV().decodeString(Constant.USER), UserBean::class.java)
        tv_balance.text = mUser?.balance

        tv_withdraw.setSingleClickListener {
            startActivityForResult(Intent(this@WalletSecStepActivity, WithdrawFirstStepActivity::class.java),0x10)
        }

        tv_recharge.setSingleClickListener {
            showToast("请升级版本")
        }
        tv_balance_detail.setSingleClickListener {
            showToast("请升级版本")
        }

    }

    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
        if(requestCode == 0x10 && resultCode == Activity.RESULT_OK) {
            setResult(Activity.RESULT_OK)
            finish()
        }
    }

    override fun start() {
    }
}